var common = {
	formatSize : function(size) {
		var gb = size/1000000000,
			mb = size/1000000,
			kb = size/1000;
		
		if (gb > 1) {
			return Math.round(gb) + " GB"
		}
		if (mb > 1) {
			return Math.round(mb) + " MB"
		}
		if (kb > 1) {
			return Math.round(kb) + " KB";
		}
		return size + " B";
	},

	formatFilname : function(filename) {
		var lastIndexOfSlash = filename.lastIndexOf("\\");
		if (lastIndexOfSlash != -1) {
			return filename.substring(lastIndexOfSlash+1)
		}
		return filename;
	},
	
	getDomain : function() {
		return document.location.host;
	},
	
	getProtocol : function() {
		return document.location.protocol;
	},
	
	removeItem : function(element) {
		if (element != null) {
			element.parentNode.removeChild(element);
		}
	},
	
	wait : function(operation, time) {
		var tmp = setTimeout(operation, time);
	},
	
	createPath : function(data) {
		return "/file/" + (data.id || "dummy-id") + "/" + (data.op || "dummy-op") + "/" + (data.filename || "dummy-filename");
	}
}